package liskovsubstitution;

import java.util.HashMap;
import java.util.Map;

public class Test {
    /**
     * 一个缩放的方法，当宽度小于等于长度时，将宽度加1
     */
    public static void resize(Rectangle rectangle) {
        while (rectangle.getWidth() <= rectangle.getLength()) {
            rectangle.setWidth(rectangle.getWidth() + 1);
            System.out.printf("width:%s length:%s\n", rectangle.getWidth(), rectangle.getLength());
        }
        System.out.printf("resize结束 width:%s length:%s\n", rectangle.getWidth(), rectangle.getLength());

    }

    public static void resizeRectangle() {
        Rectangle rectangle = new Rectangle();
        rectangle.setWidth(10);
        rectangle.setLength(20);
        resize(rectangle);
    }

    public static void resizSquare() {
//        Square square = new Square();
//        square.setWidth(10);
//        square.setLength(20);
//        resize(square);
    }

    public static void main(String[] args) {
//        resizeRectangle();
//        resizSquare();
        child();
    }

    private static void child() {
        Child child = new Child();
        HashMap hashMap = new HashMap<>();
//        Map map = new HashMap<>();
        child.method(hashMap);
    }


}
